<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>新增和修改广告</title>
	<#include '/frame/version.html'>
	<#include '/frame/manage/include_css.html'>
	<#include '/frame/manage/include_js.html'>
	<#include '/frame/taglib.html'>
    <style>
    	.w560{width: 560px;}
    </style>
</head>
<body id="nv_member" class="pg_CURMODULE">
	<#assign current="menu_banner">
	<div id="wp" class="wp">
		<#include "/include/header.html"/>
		<!--中间内容-->
		<div class="contentmanage">
			<div class="developer">
				<div class="tableContent">
					<#include "/include/left.html"/>
					<#include "/include/wxtop.html"/>
					<div class="content">
						<form method="post" id="form" action="${basePath}/admin/banner/persis">
							<div class="msgWrap form">
								<table class="userinfoArea" border="0" cellSpacing="0" cellPadding="0" width="100%">
									<tbody>
										<tr>
											<th style="width: 120px" valign="top">
												<span class="red">*</span><label for="keyword">图片标题：</label>
											</th>
											<td>
												<input type="text" class="px w560" maxlength="100" name="title" id="inp_title" value="${bean.title?default('')}" placeholder="输入图片标题，最多100字"/>
												<br/>标题是查询的依据 ，注意区分。
											</td>
										</tr>
										<tr>
											<th valign="top"><label for="pic">跳转链接：</label></th>
											<td>
												<input type="text" class="px w560"  placeholder="请输入跳转链接" name="href" id="inp_href" value="${bean.href?default('')}"/>
											</td>
										</tr>
										<tr>
											<th valign="top"><label for="pic">品牌名：</label></th>
											<td>
												<input type="text" class="px w560"  placeholder="请输入品牌名" name="name" id="inp_name" value="${bean.name?default('')}"/>
											</td>
										</tr>
										
										<tr>
											<th>
												<span class="red">*</span><label for="input_imagePath">图片文件：</label>
											</th>
											<td>
												<input type="text" readonly class="px input_width_500" id="inp_imgurl" value="${bean.imgUrl?default('')}" name="imgUrl" />
												<a href="javascript:void(0);" onclick="uploadImage(this,'banner',1, 120,80)" class="a_upload">上传</a>
												<a href="javascript:void(0);" onclick="preViewImage(this)" class="a_upload">预览</a>
											</td>
										</tr>
										<tr>
											<th valign="top"><span class="red">*</span>有效性：</th>
											<td>
												<label for="radio2"><input class="radio" type="radio" name="isValid" value="1" <#if bean.isValid!=0>checked</#if> >有效</label><br />
												<label for="radio1"><input class="radio" type="radio" name="isValid" value="0" <#if bean.isValid==0>checked</#if> >失效</label>
											</td>
										</tr>
										<tr>
											<th><span class="red">*</span><label for="title">有效期限：</label></th>
											<td>
												<select name="typeValid" onchange="changeOutDate(this);">
													<option value="1" <#if bean.typeValid == 1>selected</#if>>固定期限</option>
													<option value="0" <#if bean.typeValid == 0>selected</#if>>永久有效</option>
												</select>
											</td>
										</tr>
										<tr>
											<th><span class="red">*</span><label for="title">有效期止：</label></th>
											<td>
												<input type="text" placeholder="请选择日期" class="px" id="dueDate" value="${(bean.dueDate?string('yyyy-MM-dd'))!''}" name="dueDate"
												 readonly onClick="WdatePicker({dateFmt:'yyyy-MM-dd'});"/>
											</td>
										</tr>
										<tr>
											<th valign="top"><label for="text">优先级：</label></th>
											<td>
												<input class="px w560" name="sort" id="inp_sort" value="${bean.sort?default(0)}" maxlength="50"/>
												<br/>数值越大优先级越高，目前最大优先级是：${sort?default(0)}
											</td>
										</tr>
										<tr>
											<th></th>
											<td>
												<input type="hidden" name="id" value="${bean.id?default('')}" />
												<input type="button" value="保存" class="btnGreen left" onclick="checkFrom();"/>&nbsp;&nbsp;
											    <a href="${basePath}/admin/banner/index" class="btnGray vm">返回</a>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
						</form>
					</div>
					<div class="clr"></div>
				</div>
			</div>
		</div>
		<!--底部-->
	</div>
	<#include "/include/footer.html"/>
	
	<script type="text/javascript" src="${basePath}/js/frames/common_uploader.js"></script>
	<script type="text/javascript" src="${basePath}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
function changeOutDate(that){
	var $that = $(that);
	if($that.val()==0){
		$("#dueDate").val("2099-01-01");
	}
	<#if bean?exists && bean.dueDate?exists>
	else{
	$("#dueDate").val("${bean.dueDate?date}");
	}
	</#if>
}

function checkFrom(){
	var $inp_title=$("#inp_title");
	if(""==$inp_title.val()){
		layer.tips("标题不能为空", "#inp_title");
		$inp_title.focus();
		return false;
	}
	var $inp_imgurl = $("#inp_imgurl");
	if(""==$inp_imgurl.val()){
		layer.msg("图片不能空");
		return false;
	}
	var $dueDate = $("#dueDate");
	if(""==$dueDate.val()){
		layer.tips("有效期不能为空", "#dueDate");
		$dueDate.focus();
		return false;
	}
	$("#form").submit();
}
</script>
</body>
</html>